#!/usr/bin/make -f

SHARE = /usr/share/php/timeline-db-api
API   = timeline-db-api
DBI   = timeline-db-install

ALLDIRS = $(API) $(DBI)

build:
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	dh_clean

install: install-stamp
install-stamp:
	dh_testdir
	dh_testroot
	dh_clean
	dh_installdirs
	#
	# $(API)
	#
	mkdir -p debian/$(API)$(SHARE)
	mv *.php debian/$(API)$(SHARE)
	#
	# $(DBI)
	#
	mkdir -p debian/$(DBI)/var/cache/sql
	mv sql/*.sql debian/$(DBI)/var/cache/sql
	touch install-stamp

# Build architecture-independent files here.
binary-indep: install
	dh_testdir
	dh_testroot
	dh_fixperms
	for dir in $(ALLDIRS); do \
		find debian/$$dir -type d | xargs chmod 755; \
		find debian/$$dir -type f | xargs chmod 644; \
	done
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb


binary: binary-indep
.PHONY: clean binary-indep binary install
